//------------------------------------------------------------------------------
//  <copyright file="KukaLBR4OperationsTest.h" company="Microsoft Corporation">
// The MIT License (MIT)
// 
// Copyright (c) 2014, Microsoft Corporation
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
//  </copyright>
//------------------------------------------------------------------------------

#pragma once

#include "stdafx.h"
#include "KukaLBR4HardwareTests.h"
#include "KukaLBR4NativeTestLibImportExport.h"
#include "TestResultStringCommon.h"

#include <KukaLBR4Operations.h>

class KukaLBR4OperationsTest : public TestResultStringCommon
{
public:
	/// <summary> Maximum value for random numbers used in tests. </summary>
	static const int MaxRandValue = 1000;

	/// <summary> Test the <c>CeeOpAdd</c> operation </summary>
	static void TestCeeOpAdd();

	/// <summary> Test the <c>CeeOpAddVec6</c> operation </summary>
	static void TestCeeOpAddVec6();

	/// <summary> Test the <c>CeeOpMultiply</c> operation </summary>
	static void TestCeeOpMultiply();

	/// <summary> Test the <c>CeeOpIsMagnitudeGreaterThanVec6</c> operation </summary>
	static void TestCeeOpIsMagnitudeGreaterThanVec6();

	/// <summary> Test the <c>CeeOpIsAnyElementGreaterThanVec6</c> operation </summary>
	static void TestCeeOpIsAnyElementGreaterThanVec6();

	/// <summary> Test the <c>CeeOpCopyVec7</c> operation </summary>
	static void TestCeeOpCopyVec7();

	/// <summary> Test the <c>CeeOpCopyVec6</c> operation </summary>
	static void TestCeeOpCopyVec6();

	/// <summary> Test the <c>CeeOpSimpleJointPositionInterpolation</c> operation </summary>
	static void TestCeeOpSimpleJointInterpolation();

	/// <summary> Test the <c>CeeOpSimpleCartesianPositionInterpolation</c> operation </summary>
	static void TestCeeOpSimpleCartesianInterpolation();

	/// <summary> Test the <c>CeeOpSimpleCartesianPositionInterpolation</c> operation </summary>
	static void TestCeeOpSimpleCartesianInterpolation2();

	/// <summary> Test the <c>CeeOpAddVec7</c> operation </summary>
	static void TestCeeOpAddVec7();

	/// <summary> Test the <c>CeeOpSubtractVec7</c> operation </summary>
	static void TestCeeOpSubtractVec7();

	/// <summary> Test the <c>CeeOpAreScalarsEqual</c> operation </summary>
	static void TestCeeOpAreScalarsEqual();

	/// <summary> Test the <c>CeeOpIsForceMagnitudeGreaterThanScalar</c> operation. </summary>
	static void TestCeeOpIsForceMagnitudeGreaterThanScalar();

	/// <summary> Test the <c>SimpleInterpolation</c> function. </summary>
	static void TestSimpleInterpolation();

	/// <summary> Top level test the conversions between quaternions and frames. </summary>
	static void TestQuaternionFrameConversions();

	/// <summary> Run a single test of conversions between quaternions and frames. </summary>
	static void TestQuaternionFrameConversions(double pQuat[4]);

	/// <summary> Test multiplication of frames. </summary>
	static void TestMultiplyFrames();

	/// <summary> Test copying a frame. </summary>
	static void TestCeeOpCopyFrame();

	/// <summary> Test projection of a vector to a plane. </summary>
	static void TestVector3PlaneProject();

	/// <summary> Test projection of a 3-dim vector onto another vector. </summary>
	static void TestVector3Vector3Project();

	/// <summary> Test computing the magnitude of a vector .
	static void TestVectorMagnitude();

	/// <summary> Test computing the cross product of 2 3-dim vectors. </summary>
	static void TestVector3CrossProduct();

	/// <summary> Test computing the dot product of two vectors. </summary>
	static void TestDotProduct();

	/// <summary> Test comparison of magnitude of a force projected into a plane to a scalar value. </summary>
	static void TestCeeOpIsForceInPlaneGreaterThanScalar();

	/// <summary> Test comparison of magnitude of a force rejected from a plane to a scalar value. </summary>
	static void TestCeeOpIsForceOrthogonalToPlaneGreaterThanScalar();

private:
	/// <summary> Returns a random number </summary>
	/// <returns> A random value between 0.0 and MaxRandValue </returns>
	static double GetRandomNumber();

	/// <summary> Get a random unit quaternion </summary>
	/// <param name="pQuat"> Point to location to store random unit quaternion in. </param>;
	static void GetRandomUnitQuaternion(double *pQuat);
};

/// <summary> Test the <c>CeeOpAdd</c> operation </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpAdd(char *resultString, int bufferSize);

/// <summary> Test the <c>CeeOpAddVec6</c> operation </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpAddVec6(char *resultString, int bufferSize);

/// <summary> Test the <c>CeeOpMultiply</c> operation </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpMultiply(char *resultString, int bufferSize);

/// <summary> Test the <c>CeeOpIsMagnitudeGreaterThanVec6</c> operation </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpIsMagnitudeGreaterThanVec6(char *resultString, int bufferSize);

/// <summary> Test the <c>CeeOpIsAnyElementGreaterThanVec6</c> operation </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpIsAnyElementGreaterThanVec6(char *resultString, int bufferSize);

/// <summary> Test the <c>CeeOpCopyVec7</c> operation </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpCopyVec7(char *resultString, int bufferSize);

/// <summary> Test the <c>CeeOpCopyVec6</c> operation </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpCopyVec6(char *resultString, int bufferSize);

/// <summary> Test the <c>CeeOpSimpleJointPositionInterpolation</c> operation </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpSimpleJointPositionInterpolation(char *resultString, int bufferSize);

/// <summary> Test the <c>CeeOpAddVec7</c> operation </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpAddVec7(char *resultString, int bufferSize);

/// <summary> Test the <c>CeeOpSubtractVec7</c> operation </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpSubtractVec7(char *resultString, int bufferSize);

/// <summary> Test the <c>CeeOpAreScalarsEqual</c> operation </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpAreScalarsEqual(char *resultString, int bufferSize);

/// <summary> Test the <c>CeeOpSimpleCartesianInterpolation</c> operation </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpSimpleCartesianInterpolation(char *resultString, int bufferSize);

/// <summary> Test the <c>CeeOpSimpleCartesianInterpolation</c> operation </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpSimpleCartesianInterpolation2(char *resultString, int bufferSize);

/// <summary> Test the <c>SimpleInterpolation</c> operation </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestSimpleInterpolation(char *resultString, int bufferSize);

/// <summary> Test the conversions between quaternions and frames. </summary.
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestQuaternionFrameConversions(char *resultString, int bufferSize);

/// <summary> Test the multiplication of frames </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestMultiplyFrames(char *resultString, int bufferSize);

/// <summary> Test copying a frame. </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpCopyFrame(char *resultString, int bufferSize);

/// <summary> Test the <c>CeeOpIsForceMagnitudeGreaterThanScalar</c> operation. </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpIsForceMagnitudeGreaterThanScalar(char *resultString, int bufferSize);

/// <summary> Test projection of a vector to a plane. </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestVector3PlaneProject(char *resultString, int bufferSize);

/// <summary> Test projection of a 3-dim vector onto another vector. </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestVector3Vector3Project(char *resultString, int bufferSize);

/// <summary> Test computing the magnitude of a vector .
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestVectorMagnitude(char *resultString, int bufferSize);

/// <summary> Test comparison of magnitude of a force projected into a plane to a scalar value. </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpIsForceInPlaneGreaterThanScalar(char *resultString, int bufferSize);

/// <summary> Test comparison of magnitude of a force rejected from a plane to a scalar value. </summary>
/// <param name="resultString"> buffer for a failure message or indication that test passed. </param>
/// <param name="buffersize"> length of <c>resultString</c> buffer. </param>
extern "C" KUKALBR4NATIVETESTS_API void TestCeeOpIsForceOrthogonalToPlaneGreaterThanScalar(char *resultString, int bufferSize);
